﻿namespace BloggerBackup
{
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DefaultBindingProperty("SelectedPath"), DefaultProperty("SelectedPath"), Designer(typeof(SmartTagDesigner)), DesignerGenerated]
    public class FolderPicker : UserControl
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("EllipsisButton")]
        private Button _EllipsisButton;
        [AccessedThroughProperty("FolderBrowserDialog1")]
        private FolderBrowserDialog _FolderBrowserDialog1;
        [AccessedThroughProperty("SelectedPathTextbox")]
        private TextBox _SelectedPathTextbox;
        private bool _selectOnFocus;
        private IContainer components;

        [DebuggerNonUserCode]
        public FolderPicker()
        {
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (((disposing && (this.components != null)) ? 1 : 0) != 0)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void EllipsisButton_Click(object sender, EventArgs e)
        {
            this.FolderBrowserDialog1.SelectedPath = this.SelectedPathTextbox.Text;
            if (this.FolderBrowserDialog1.ShowDialog(this) == DialogResult.OK)
            {
                this.SelectedPathTextbox.Text = this.FolderBrowserDialog1.SelectedPath;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            this.EllipsisButton = new Button();
            this.SelectedPathTextbox = new TextBox();
            this.FolderBrowserDialog1 = new FolderBrowserDialog();
            this.SuspendLayout();
            this.EllipsisButton.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            Point point = new Point(0xb1, 1);
            this.EllipsisButton.Location = point;
            this.EllipsisButton.Name = "EllipsisButton";
            Size size = new Size(0x18, 20);
            this.EllipsisButton.Size = size;
            this.EllipsisButton.TabIndex = 0x1b;
            this.EllipsisButton.Text = "...";
            this.EllipsisButton.TextAlign = ContentAlignment.TopCenter;
            this.EllipsisButton.UseVisualStyleBackColor = true;
            this.SelectedPathTextbox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            point = new Point(0, 0);
            this.SelectedPathTextbox.Location = point;
            this.SelectedPathTextbox.MaxLength = 250;
            this.SelectedPathTextbox.Name = "SelectedPathTextbox";
            size = new Size(0xb1, 20);
            this.SelectedPathTextbox.Size = size;
            this.SelectedPathTextbox.TabIndex = 0x1c;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.Controls.Add(this.SelectedPathTextbox);
            this.Controls.Add(this.EllipsisButton);
            this.Name = "FolderPicker";
            size = new Size(0xc9, 20);
            this.Size = size;
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void SelectedPathtextbox_Enter(object sender, EventArgs e)
        {
            if (this._selectOnFocus)
            {
                this.SelectedPathTextbox.SelectAll();
            }
        }

        [Category("Behavior")]
        public override System.Windows.Forms.ContextMenu ContextMenu
        {
            get
            {
                return this.SelectedPathTextbox.ContextMenu;
            }
            set
            {
                this.SelectedPathTextbox.ContextMenu = value;
            }
        }

        [Category("Folder Browsing"), DefaultValue("")]
        public string Description
        {
            get
            {
                return this.FolderBrowserDialog1.Description;
            }
            set
            {
                this.FolderBrowserDialog1.Description = value;
            }
        }

        internal virtual Button EllipsisButton
        {
            [DebuggerNonUserCode]
            get
            {
                return this._EllipsisButton;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.EllipsisButton_Click);
                if (this._EllipsisButton != null)
                {
                    this._EllipsisButton.Click -= handler;
                }
                this._EllipsisButton = value;
                if (this._EllipsisButton != null)
                {
                    this._EllipsisButton.Click += handler;
                }
            }
        }

        internal virtual FolderBrowserDialog FolderBrowserDialog1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._FolderBrowserDialog1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._FolderBrowserDialog1 = value;
            }
        }

        [Category("Behavior"), DefaultValue(250)]
        public int MaxLength
        {
            get
            {
                return this.SelectedPathTextbox.MaxLength;
            }
            set
            {
                this.SelectedPathTextbox.MaxLength = value;
            }
        }

        [DefaultValue(false), Category("Behavior")]
        public bool Multiline
        {
            get
            {
                return this.SelectedPathTextbox.Multiline;
            }
            set
            {
                this.SelectedPathTextbox.Multiline = value;
                if (value)
                {
                    this.SelectedPathTextbox.Height = this.Height;
                }
                else if (!value)
                {
                    this.Height = this.SelectedPathTextbox.Height;
                }
            }
        }

        [DefaultValue(typeof(Environment.SpecialFolder), "Desktop"), Category("Appearance")]
        public Environment.SpecialFolder RootFolder
        {
            get
            {
                return this.FolderBrowserDialog1.RootFolder;
            }
            set
            {
                this.FolderBrowserDialog1.RootFolder = value;
            }
        }

        [DefaultValue(typeof(System.Windows.Forms.ScrollBars), "None"), Category("Appearance")]
        public System.Windows.Forms.ScrollBars ScrollBars
        {
            get
            {
                return this.SelectedPathTextbox.ScrollBars;
            }
            set
            {
                this.SelectedPathTextbox.ScrollBars = value;
            }
        }

        [Category("Data"), DefaultValue("")]
        public string SelectedPath
        {
            get
            {
                return this.SelectedPathTextbox.Text;
            }
            set
            {
                this.SelectedPathTextbox.Text = value;
            }
        }

        internal virtual TextBox SelectedPathTextbox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SelectedPathTextbox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.SelectedPathtextbox_Enter);
                if (this._SelectedPathTextbox != null)
                {
                    this._SelectedPathTextbox.Enter -= handler;
                }
                this._SelectedPathTextbox = value;
                if (this._SelectedPathTextbox != null)
                {
                    this._SelectedPathTextbox.Enter += handler;
                }
            }
        }

        [Category("Behavior"), DefaultValue(false)]
        public bool SelectOnFocus
        {
            get
            {
                return this._selectOnFocus;
            }
            set
            {
                this._selectOnFocus = value;
            }
        }

        [Category("Folder Browsing"), DefaultValue(true)]
        public bool ShowNewFolderButton
        {
            get
            {
                return this.FolderBrowserDialog1.ShowNewFolderButton;
            }
            set
            {
                this.FolderBrowserDialog1.ShowNewFolderButton = value;
            }
        }

        [Category("Appearance"), DefaultValue(typeof(HorizontalAlignment), "Left")]
        public HorizontalAlignment TextAlign
        {
            get
            {
                return this.SelectedPathTextbox.TextAlign;
            }
            set
            {
                this.SelectedPathTextbox.TextAlign = value;
            }
        }
    }
}

